<template>
  <el-form ref="form" label-position="right" :model="currentRow" label-suffix="："
           label-width="140px">
    <div class="main-risk-level">
      <el-form-item label="总体风险评估等级">
        <el-radio-group v-model="currentRow.mainRiskLevel">
          <el-radio v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
          </el-radio>
        </el-radio-group>
      </el-form-item>
    </div>

    <div class="geology">
      专项风险评估
    </div>
    <div class="special">
      <el-row :gutter="20">
        <el-col :span="12">
          <div class="geology-children5">
            边坡开挖
          </div>
          <el-form-item label="施工前">
            <el-radio-group v-model="currentRow.dig.before">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="施工过程中">
            <el-radio-group v-model="currentRow.dig.doing">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <div class="geology-children5">
            人工挖孔桩
          </div>
          <el-form-item label="施工前">
            <el-radio-group v-model="currentRow.hole.before">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="施工过程中">
            <el-radio-group v-model="currentRow.hole.doing">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <div class="geology-children5">
            排水隧洞
          </div>
          <el-form-item label="施工前">
            <el-radio-group v-model="currentRow.drain.before">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="施工过程中">
            <el-radio-group v-model="currentRow.drain.doing">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <div class="geology-children5">
            预应力锚固
          </div>
          <el-form-item label="施工前">
            <el-radio-group v-model="currentRow.anchored.before">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="施工过程中">
            <el-radio-group v-model="currentRow.anchored.doing">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <div class="geology-children5">
            抗滑挡墙
          </div>
          <el-form-item label="施工前">
            <el-radio-group v-model="currentRow.wall.before">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="施工过程中">
            <el-radio-group v-model="currentRow.wall.doing">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <div class="geology-children5">
            边坡注浆
          </div>
          <el-form-item label="施工前">
            <el-radio-group v-model="currentRow.slip.before">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="施工过程中">
            <el-radio-group v-model="currentRow.slip.doing">
              <el-radio-button v-for="item in EnumRiskLevelList" :key="item.code" :label="item.code">{{item.name}}
              </el-radio-button>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>
    </div>
    <div class="geology">
      pdf风险评估文件
    </div>
    <div v-if="isLook">
      <div v-for="(item,index) in riskFile" :key="index" style="text-align: center;display: inline-block;margin-left: 20px;font-size: 20px">
        <a :download="item.name" :href="item.url" style="color:black">
          <i class="iconfont iconPDF" style="font-size: 70px;color:red"></i>
          <br/>
          {{item.name}}
        </a>
      </div>
    </div>
    <upload-file v-model="currentRow.riskFileList" ref="uploadClear" v-else></upload-file>
  </el-form>
</template>
<script>

import ItemMixins from "./item.mixins";
import UploadFile from '@/components/upload-file'
import Enums from '@/utils/enums'

export default {
  props: ['value','isLook'],
  mixins: [ItemMixins,Enums],
  components: {UploadFile},
  data() {
    return {
      EnumRiskLevel: [],
      // 单位信息表单 校验规则
    }
  },
  computed: {
    EnumRiskLevelList(){
      let list = []
      this.EnumRiskLevel.map(x=>{
        if(x.name != '未进行风险评估'){
          list.push(x)
        }
      })
      return list
    },

    riskFile(){
      return this.filePathHandle(this.currentRow.riskFileList)
    },
    currentRow: {
      get() {
        return this.value
      },
      set(value) {
        this.$emit('input', value)
      }
    }
  },
  methods: {  //选择路线
    test() {
    },
    // 内部表单校验
    _validatorForm() {
      return new Promise((resolve) => {
        this.$refs.form.validate((valid) => {
          valid && resolve()
        })
      })
    }
  },
  mounted() { //如果是查看详情，把文件地址处理
    if(this.isLook){
      this.filePathHandle(this.currentRow.prospectionFileList)
    }
    this.queryDictList(['EnumRiskLevel'], ['EnumRiskLevel']);
  }
}
</script>

<style lang="less">
  .form_compact {
    display: flex;

    & /deep/ .el-input input {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }

    & /deep/ .el-button {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
    }
  }

  .el-button {
    padding-right: 40px;
  }

  .el-form-item__label {
    /*padding: 0px;*/
  }

  input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
  }

  .geology {
    font-size: 20px;
    border-bottom: 1px solid;
    margin-bottom: 20px;
    margin-top: 20px;
  }

  .geology-children5 {
    font-size: 15px;
    border-bottom: 1px solid;
    margin-bottom: 10px;
    margin-top: 10px;
    color: #1990FE;
    font-weight: 600;
  }

  .special {
    margin-left: 20px;
  }

  .main-risk-level {
    .el-form-item__label {
      width: 180px !important;
      font-size: 20px;
    }

    .el-radio__label {
      font-size: 20px;
      padding-left: 10px;
    }
    .el-radio__inner {
      width: 20px;
      height: 20px;
    }
  }
</style>
